import React, { Component } from 'react'
import Alert from '@material-ui/lab/Alert';
import "./less/MyAlert.less"
import { connect } from 'react-redux';

class MyAlert extends Component {
    render() {
        return <Alert variant="filled" className="my_alert" severity={this.props.alertColor} style={{ display: this.props.showAlert ? 'flex' : 'none' }}>{this.props.alertContent}</Alert>
    }
}

const mapStateToProps = (state) => {
    return {
        alertContent: state.alertContent,
        showAlert: state.showAlert,
        alertColor: state.alertColor
    }
}

export default connect(mapStateToProps)(MyAlert)
